

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rotating Cube with Images</title>
<style>
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden; /* 防止图片溢出视口 */
  }

  .cube {
    position: relative;
    width: 200px; /* 根据图片尺寸调整 */
    transform-style: preserve-3d;
    animation: rotate 5s infinite linear;
  }

  .face {
    position: absolute;
    width: 200px; /* 根据图片尺寸调整 */
    height: 200px; /* 根据图片尺寸调整 */
    background-size: cover; /* 图片覆盖整个面 */
    background-position: center; /* 图片居中显示 */
  }

  .front { background-image: url(./OIP-C.jpg); transform: translateZ(100px); }
  .back { background-image: url(./OIP-C\ \(1\).jpg); transform: rotateY(180deg) translateZ(100px); }
  .left { background-image: url(./OIP-C\ \(2\).jpg); transform: rotateY(-90deg) translateZ(100px); }
  .right { background-image: url(./OIP-C\ \(3\).jpg); transform: rotateY(90deg) translateZ(100px); }
  .top { background-image: url(./OIP-C\ \(4\).jpg); transform: rotateX(90deg) translateZ(100px); }
  .bottom { background-image: url(./OIP-C\ \(5\).jpg); transform: rotateX(-90deg) translateZ(100px); }

  @keyframes rotate {
    from { transform: rotateX(0deg) rotateY(0deg); }
    to { transform: rotateX(360deg) rotateY(360deg); }
  }
</style>
</head>
<body>

<div class="cube">
  <div class="face front"></div>
  <div class="face back"></div>
  <div class="face left"></div>
  <div class="face right"></div>
  <div class="face top"></div>
  <div class="face bottom"></div>
</div>

</body>
</html